<?

function V_Services_List($arrayData, $arrayData_Service_type) {
    $ulr = "?" . MODUL . "=services&" . ACTION . "=";
    $totalRows = 0;
    $curPage = 1;
    $strStart = 0;
    $strEnd = 0;
    $curPage = CM_getParameter("curPg");
    if (((int) $curPage) == 0)
	$curPage = 1;

    $totalRows = count($arrayData);

    $totalPage = (int) ($totalRows / NUM_ROW_ON_PAGE_SERVICES);
    if ($totalRows % NUM_ROW_ON_PAGE_SERVICES > 0)
	$totalPage++;

    if ($totalRows > 0) {
	$strStart = ($curPage - 1) * NUM_ROW_ON_PAGE_SERVICES + 1;
	$strEnd = ($curPage ) * NUM_ROW_ON_PAGE_SERVICES;
	if ($strEnd > $totalRows)
	    $strEnd = $totalRows;
    }
    $parent_id = CM_getParameter('parent_id');
    if ($parent_id != "") {
	$url = "&parent_id=$parent_id";
    }
    $lable_type = $arrayData_Service_type['service_type_name'];
    if ($lable_type == "") {
	$lable_type = "Tất cả dịch vụ";
    }
    ?>
    <script>
        function GotoPage(iPage) {
    	document.frm.action = document.frm.action + "&curPg=" + iPage;
    	document.frm.submit();
        }
    </script>
    <div>
        <form name="frm" action="<?= $ulr ?>List<?= $url ?>"  method="post" enctype="multipart/form-data">
    	<h3><?= $lable_type ?></h3>
	    <?
	    if (!empty($arrayData)) {
		$i = 0;
		$curRow = 0;
		foreach ($arrayData as $value) {
		    $curRow++;
		    if ($curRow < $strStart)
			continue;
		    if ($curRow > $strEnd)
			break;
		   ?>
	    	<div class="title_services" style="margin-top: 0px;border-bottom: 1px solid #dfdfdf;font-style: italic"><h4><b><?= $value['services_name'] ?></b></h4></div>
	    	<div style="margin-top: 30px"><?= $value['services_info'] ?></div>
		<? } ?>
		<br/>
		<br/>
		<div style="margin-top: 20px;float: right">
		    <?
		    $page = CM_getParameter("curPg");
		    if ($page == '') {
			$page = 1;
		    }
		    ?>
		    Trang thứ : <span style="color:#F00;"><?= $page ?></span>&nbsp;&nbsp;Tổng số trang: <span style="color:#F00;"><?= $totalPage ?></span><br />

		    <?
		    if ($totalPage > 1) {
			echo "<a href =\"javascript:GotoPage('1')\" style=\"text-decoration:none; \">&laquo; Trang đầu</a>&nbsp;&nbsp;&nbsp;";
			for ($i = 1; $i <= $totalPage; $i++) {
			    if ($i < $curPage + 5 && $i > $curPage - 5) {

				if ($i != $curPage)
				    echo "<a href=\"javascript:GotoPage('$i')\" style=\"text-decoration:none; \">$i</a>&nbsp;&nbsp;";
				else
				    echo "<SPAN class=bk12-140 style=\"color:#FF0000;\">$i&nbsp;&nbsp;</SPAN>";
			    }
			}
			echo "&nbsp;&nbsp;&nbsp;<a href =\"javascript:GotoPage('" . $totalPage . "')\" style=\"text-decoration:none; \">Trang cuối &raquo;</a>  ";
		    }
		    ?>
		</div>
		<?
	    } else {
		echo "Hiên tại chưa có dịch vụ nào !.";
	    }
	    ?>
        </form>
    </div>
    <?
}
?>